package cn.hdmis.util;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class ObjectUtil {
	/**
	 * 去除Map中value为NULL的对象
	 * 
	 * @param Map
	 * @return Map
	 */
	public static  Map<String, Object> filterMapNull(Map<String, Object>  map){
		if(map==null||map.size()<1){
			return null;
		}
		try {
				Set<String> keySet = map.keySet();
				List<String> tempList = new ArrayList<String>();
				for(Object key : keySet){
					if(map.get(key)==null||map.get(key).toString().trim().isEmpty()){
						tempList.add((String) key);
					}
				}
				for (String key : tempList) {
					map.remove(key);
				}
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		return map;
	}
}
